package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.CategoryPageQueryDTO;
import com.sky.entity.Category;
import com.sky.enumeration.OperationType;
import com.sky.myannotation.MyAutoFill;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;
import java.util.List;

public interface CategoryMapper {

    @MyAutoFill(OperationType.UPDATE)
    void updateCategory(Category category);

    Page<Category>  getCategoryPage(CategoryPageQueryDTO categoryPageQueryDTO);
    @MyAutoFill(OperationType.INSERT)
    void addCategory(Category category);

    void delCategoryBy(ArrayList<Long> ids);

    List<Category> queryByType(Integer type);

    @Select("select * from category where id = #{categoryId}")
    List<Category> findDishCateGoryByIds(Long categoryId);

    @Select("select * from category where id = #{id}")
    Category findDishCateGoryById(Long id);

    List<Category> list(Integer type);
}
